{% extends "base.html" %}
{% load i18n %}

{% block page-title %}
  {% if booking and booking.id %}
    {% trans "History" %} <a href="">{{ booking.get_key }}</a>: {{ booking.get_title }} {% if booking.is_closed %}({% trans "closed" %}){% endif %}
  {% else %}
    {{ date }}, {{ page_title }}
  {% endif %}
{% endblock %}

{% block sub-navigation %}
{% endblock %}

{% block content %}
  {% csrf_token %}
  <h3>
    <a id="bookings-pointer" href="javascript:inhouse.toggle_section('bookings');" class="toggled-section">{% trans "Booking history" %}</a>
  </h3>
  <div id="bookings" class="default-list">
    <div class="pagination">
      <div style="float: left">
      </div>
      <div style="float: right;">
        {% if not booking.is_closed %}
          <input type="submit" value="{% trans "Revert" %}" name="revert" onclick="javascript:inhouse.tracking.revert_booking('booking-list')">
        {% endif %}
      </div>
    </div>
    <table id="booking-list" class="default-table">
      <thead>
        {% include "booking_history_heading.html" %}
      </thead>
      <tbody>
        {% for history in histories.object_list %}
          {% include "booking_history_row.html" %}
        {% empty %}
          <tr><td class="first last" colspan="11">{% trans "No entries found" %}</td></tr>
        {% endfor %}
      </tbody>
    </table>
    <div class="pagination">
      {% include "pagination.html" with objects=histories %}
    </div>
  </div>
  <form method="post">{% csrf_token %}
  <table>
      <tr>
        <td><input name="cancel" type="submit" value="{{ cancel_value }}"></td>
      </tr>
    </table>
  </form>
{% endblock %}
